﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace XPathAutoSuggest {
    /// <summary>This interface lays-out functionality that is required for tasks specific to evaluating XPath queries
    /// and making suggested XPath queries</summary>
    /// <remarks>
    /// From SOLID programming practices, "Depend upon Abstractions. Do not depend upon concretions.”
    /// Also, "many client specific interfaces are better than one general purpose interface."
    /// </remarks>
    public interface IMainModelView {
        /// <summary>Whether the evaluate command can execute</summary>
        /// <returns>True/false</returns>
        bool EvaluateCommandCanExecute();
        /// <summary>Evaluates users' XPath and determines whether there are hits</summary>
        void EvaluateExecute();
        /// <summary>Evaluates users' XPath - overloaded version that takes specific XPath query</summary>
        /// <param name="xPathQuery"></param>
        void EvaluateExecute(string xPathQuery);

        /// <summary>Whether the suggest command can execute</summary>
        /// <returns>True/false</returns>
        bool SuggestCanExecute();
        /// <summary>Examines users selection within their XML and attempts to sugges an XPath query to locate it</summary>
        void SuggestExecute();

        /// <summary>An even the window can catch instructing it to close</summary>
        event CloseXmlFormEventHandler CloseXmlForm;
        
        /// <summary>Whether users' XML can be reformatted for them</summary>
        /// <returns>True/false</returns>
        bool FormatCommandCanExecute();
        /// <summary>Formats users' XML</summary>
        void FormatCommandExecute();

        /// <summary>Whether user can launch the form containing XPath links</summary>
        /// <returns>true</returns>
        bool ShowLinksCommandCanExecute();
        /// <summary>Launches a form containing links to XPath on the web</summary>
        void ShowLinksCommandExecute();

        /// <summary>Whether user can launch the About form</summary>
        /// <returns>true</returns>
        bool AboutCommandCanExecute();
        /// <summary>Launches the About window</summary>
        void AboutCommandExecute();

        /// <summary>Whether the ValidateXml command can fire</summary>
        /// <returns></returns>
        bool ValidateXmlCommandCanExecute();
        /// <summary>Validates user&apos;s XML and displays a message</summary>
        void ValidateXmlCommandExecute();

        /// <summary>Position (index) of users selected text within their XML</summary>
        int SelectionStart { get; set; }
        /// <summary>An XML fragment selected by user</summary>
        string SelectedXml { get; set; }
        /// <summary>The users' XML that will be used for evaluating XPath queries</summary>
        string FormattedXml { get; set; }

        /// <summary>An XPath query to attempt to evaluate</summary>
        string XPathQuery { get; set; }

        /// <summary>A list of suggested queries</summary>
        ObservableCollection<QueryDescPair> QuerySuggestions { get; }

        /// <summary>Feedback information for user suitable for displaying in a status bar</summary>
        string StatusInfo { get; set; }
    }
}
